Centos 7.4 Server time Synchronization configuration method [Based on NTP Service]
- 2021-01-02 22:08:27
- OfStack
This article illustrates the Centos 7.4 server time synchronization configuration approach. To share for your reference, the details are as follows:
yum Install NTP server
#yum -y install ntp
Start the ntp service
#systemctl start ntpd
3. Set startup time
#systemctl enable ntpd
4. Modify startup parameters and add -ES16en-ES17en parameters to allow ntp service to work normally even when the system time error is large
#vi /etc/sysconfig/ntpd
OPTIONS= "-g -x"
5. Read the current time
#timedatectl
6. Set the time zone for Asia/Shanghai
#timedatectl set-timezone Asia/Shanghai
7. Enable NTP server synchronization
#timedatectl set-ntp yes
8. Check the server time. If the server time is still out of sync, manually synchronize the server time
#/usr/sbin/ntpdate ntp.api.bz
Error "the NTP socket is in use, exiting".
8 Nov 09:57:02 ntpdate[4726]:the NTP socket is in use, exiting
9. The reason for this error is that the system ntpd server is running. Check with ps aux | grep ntpd and you will see that ntpd is running.
Solutions:
#systemctl stop ntpd
#/usr/sbin/ntpdate ntp.api.bz
10. Check the time last
#timedatectl
Hopefully, this article has helped you with your CentOS server configuration.